<template>
  <base-page class="base-form" title="得分详情" @back="onCancel()">
    <view class="main-box">
      <view class="content-box">
        <view class="container">
          <uni-list>
            <view v-for="(i, k) in scoreResult.scoreDetails" :key="k">
              <uni-list-item
                showExtraIcon="true"
                :extraIcon="{ type: 'email-filled' }"
                :title="i.subjectName"
                :rightText="i.score + ''"
              />
            </view>
            <uni-list-item
              showExtraIcon="true"
              :extraIcon="{ type: 'auth-filled' }"
              title="总分数"
              :rightText="scoreResult.score + ''"
            />
          </uni-list>
        </view>
      </view>
    </view>
  </base-page>
</template>

<script>
import { CourseInfoController } from "@/api";
export default {
  data() {
    return {
      scoreResult: {},
    };
  },
  onLoad(option) {
    this.getScoreDetail(JSON.parse(decodeURIComponent(option.obj)));
  },
  methods: {
    getScoreDetail(obj) {
      CourseInfoController.getScoreDetail(this, obj)
        .then((res) => {
          this.scoreResult = res;
        })
        .catch((err) => {
          console.error(err);
        });
    },
    onCancel() {
      uni.navigateBack();
    },
  },
};
</script>

<style lang="scss">
page {
  background-color: #ffffff;
}
</style>